package day04.homework;

import java.time.LocalDate;
import java.util.Scanner;

//2. 接收用户输入的年份year和月份month，计算该年该月的天数，并输出
public class Answer2 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("输入年份");
        int year=scanner.nextInt();
        System.out.println("输入月份");
        int month=scanner.nextInt();
        int days=getDays(year,month);
        System.out.println(year+"年"+month+"月"+"天数:"+days);

    }
    private static int getDays(int year, int month) {
        LocalDate localDate=LocalDate.of(year,month,1);
        return localDate.lengthOfMonth();
    }
}
